package com.sgzn.sgpay.persistence.manager;

import com.sgzn.sgpay.persistence.dao.TBizOrderMapper;
import com.sgzn.sgpay.persistence.domain.TBizOrder;
import com.sgzn.sgpay.persistence.domain.TBizOrderExample;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author huangsenguang
 * @version Id: BizOrderManager.java, v 0.1 2018/5/28 23:25 huangsenguang Exp $$
 */
@Slf4j
@Component
public class BizOrderManager {
    @Resource
    private TBizOrderMapper tBizOrderMapper;
    
    /**
     * 获取设备id集合的所有设备
     * @param deviceIdList
     * @return
     */
    public List<TBizOrder> getBizOrdersByIds(List<String> deviceIdList, Date beginTime, Date endTime){
        TBizOrderExample example = new TBizOrderExample();
        TBizOrderExample.Criteria cra = example.createCriteria();
        cra.andUpdatedAtBetween(beginTime, endTime);
        cra.andOrderDeviceIn(deviceIdList);
        List<TBizOrder> list = tBizOrderMapper.selectByExample(example);
        return list;
    }
}

